package api

import (
	"gitee.com/failurejack/smart-construction/service"
	"github.com/gin-gonic/gin"
)

type UserApi struct{}

var UserApiApp = new(UserApi)

func (u *UserApi) CreateUser(c *gin.Context) {

}

func (u *UserApi) DeleteUser(c *gin.Context) {

}

func (u *UserApi) GetUser(c *gin.Context) {
	c.JSON(200, gin.H{
		"message": "pong",
	})
}

func (u *UserApi) UpdateUser(c *gin.Context) {

}

func (u *UserApi) Login(c *gin.Context) {

}

func (u *UserApi) Logout(c *gin.Context) {

}

func (u *UserApi) Register(c *gin.Context) {

}

func (u *UserApi) ResetPassword(c *gin.Context) {

}

func (u *UserApi) GetUserList(c *gin.Context) {
	userList, total, err := service.UserServiceApp.GetUserList()
	if err != nil {
		c.JSON(400, gin.H{
			"message": "failure",
		})
		return
	}
	c.JSON(200, gin.H{
		"total":   total,
		"data":    userList,
		"message": "success",
	})
}
